import { reqHeartTestAll } from "../../api/homeHeartTest";

Page({
	data: {
		channelId: 409,
		pageNo: 1,
		pageSize: 15,
		excludeType:3,
		listData: [],
		loading: 0,
	},
	onLoad(options) {
		this.getData();
	},
	onReachBottom() {
		let page = this.data.pageNo + 1;
		if (this.data.loading == 2) {
			return;
		}
		this.setData({ pageNo: page, loading: 1 })
		this.getData();
	},
	async getData(){
		let {channelId,pageNo,pageSize,excludeType} = this.data;
		let res = await reqHeartTestAll({channelId,pageNo,pageSize,excludeType});
		if(res.code == 1){
			if(res.data.list.length==0){
				this.setData({loading:2});
			}else {
				this.setData({loading:0});
			}
			this.setData({listData:[...this.data.listData,...res.data.list]});
		}
	},
	goBack() {
		wx.navigateBack();
	},
});
